using System;

namespace WindowsPhoneAudioStreaming.Audio.Streaming {
    public interface IRawMediaStreamSource : IDisposable {
        #region events

        /// <summary>
        /// 	Provides raw sample data to the consumer
        /// </summary>
        event SampleReadyDelegate SampleReady;

        /// <summary>
        /// 	Provides the percentage of asynchronous data downloaded
        /// </summary>
        event DownloadProgressChangedDelegate DownloadProgressChanged;

        #endregion

        #region methods

        /// <summary>
        /// 	Delegate to allow the modification of raw audio data before being consumed
        /// </summary>
        /// <param name="audioPreProcessorDelegate"></param>
        void SetAudioPreProcessor(AudioPreProcessorDelegate audioPreProcessorDelegate);

        #endregion

        #region properties

        /// <summary>
        /// 	Get or Set the position in time of the audio to playing or to play.
        /// </summary>
        TimeSpan Position {
            get;
            set;
        }

        /// <summary>
        ///  The number of seperate audio channels
        /// </summary>
        int NumberOfChannels {
            get;
        }

        /// <summary>
        /// 	The average bytes per seconds needed to playback 1 second of audio
        /// </summary>
        int AverageBytesPerSecond {
            get;
        }

        /// <summary>
        /// 	The number of bits used to encode 1 sample
        /// 	<example>
        /// 		8 or 16 bits, in other words, the audio uses 1 or 2 bytes to represent 1 sample of audio
        /// 	</example>
        /// </summary>
        int BitsPerSample {
            get;
        }

        /// <summary>
        /// 	Some audio formats, for example MP3, can use both Constant (CBR) and Variable (VBR) bitrates to store audio
        /// </summary>
        bool BitrateIsConstant {
            get;
        }

        /// <summary>
        /// 	The Sampling frequency.
        /// 	More samples per second = higher quality (not taking compression into account).
        /// 	For example, 44100 (44.1Khz) means that 1 second of audio data is made up of 44100 individual samples
        /// 	and each individual sample may be 1, 2 or more bytes in size
        /// 	<see cref="BitsPerSample"/>
        /// </summary>
        int SamplesPerSecond {
            get;
        }

        int DurationInMilliseconds {
            get;
        }

        /// <summary>
        ///  To support different formats of audio formats
        /// </summary>
        AudioTypeEnumeration AudioType {
            get;
        }

        #endregion
    }
}
